<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">
        <br />
        <br />
        <center><img src="../images/step1.gif"></img></center>
        <br />
        <br />
         Votre panier contient
        <xsl:value-of select="count(//product)" /> produit(s)
        <br />
        <br />


        <xsl:choose>
            <xsl:when test="count(//product) = 0">
                
            </xsl:when>
            <xsl:otherwise>

                <table class="listeComptes">
                    <tr>
                        <td>
                            
                        </td>
                        <td>
                            <b>Produit</b>
                        </td>
                        <td>
                            <b>Quantité</b>
                        </td>
                        <td>
                            <b>Prix</b>
                        </td>
                        <td>
                            <b>Actions</b>
                        </td>
                    </tr>

                    <xsl:for-each select="//product">
                        <tr>
                            <td>
                                 <img src="{concat('../produits/', @id,'.jpg')}" />
                            </td>
                            <td>
                                <xsl:value-of select="name" />
                            </td>
                            <td>
                                <xsl:value-of select="quantity" />
                            </td>
                            <td>
                                <xsl:value-of select="concat(price,price/@currency)" />
                            </td>
                            <td>

                                <xsl:choose>
                                    <xsl:when test="quantity &lt; 1">
                                Quantité : indisponible
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <form action="../user/RemoveLineInCart.do">
                                            <input name="id_store" value="{store/@id}" type="hidden" />
                                            <input name="id_product" value="{@id}" type="hidden" />
                                            <input name="action" value="remove" type="hidden" />
                                            <input>
                                                <xsl:attribute name="type">text</xsl:attribute>
                                                <xsl:attribute name="name">quantity</xsl:attribute>
                                                <xsl:attribute name="size">2</xsl:attribute>
                                                <xsl:attribute name="value">0</xsl:attribute>
                                                <xsl:attribute name="onChange">
                                                    <xsl:value-of select="concat('check_value_in_range(this, 0, ', quantity, ')')" />
                                                </xsl:attribute>
                                            </input>
                                            <input type="submit" value="Retirer"></input>
                                        </form>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </td>
                        </tr>
                    </xsl:for-each>

                    <tr>                       
                        <td colspan="5" style="text-align:right;">
                            Total :
                            <b>
                                <xsl:value-of select="concat(/cart/total, ' ', /cart/total/@currency, ' ')" />
                            </b> Tva incl.
                        
                        </td>
                    </tr>
                </table>

            </xsl:otherwise>
        </xsl:choose>
        
    </xsl:template>
</xsl:stylesheet>
